package com.cc.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Page<T>{
    // 当前页码
    private int pageNum=1;
    // 每页显示条数
    private int pageSize=5;
    // 总记录数
    private int total;
    // 总页数
    private int totalPage;
    // 当前页数据
    private List<T> data;

    public void setTotal(int total){
        if (total > 0){
            this.total = total;
            // 计算总页数
            this.totalPage = (total%pageSize == 0)? (total/pageSize) : (total/pageSize + 1);
        }
        this.total=total;
    }
}
